<template>
  <div style="padding: 20px; border-radius: 8px">
    <!-- 原始数据上传窗口 -->
    <el-dialog
      title="上传"
      :visible.sync="uploadButtonSummary"
      width="30%"
      center
    >
      <el-form
        ref="elForm"
        :model="Summary"
        :rules="Summaryrules"
        size="medium"
        label-width="90px"
        label-position="left"
         @submit.native.prevent
      >
        <el-form-item label="日期选择" prop="field104">
          <el-date-picker
            v-model="Summary.field104"
            format="yyyy-MM-dd"
            value-format="yyyy-MM-dd"
            :style="{ width: '100%' }"
            placeholder="请选择日期选择"
            :picker-options="pickerOptions0"
            clearable
          ></el-date-picker>
        </el-form-item>

        <el-form-item label="上传" prop="field103" required>
          <el-upload
            ref="field103"
            :file-list="field103fileList"
            :action="UploadUrl()"
            :on-change="handleChange8"
            :auto-upload="false"
            accept=".xlsx,.xls"
          >
            <el-button type="primary" icon="el-icon-upload"
              >点击上传</el-button
            >
          </el-upload>
        </el-form-item>
      </el-form>

      <span slot="footer" class="dialog-footer">
        <el-button @click="uploadButtonSummary = false">取 消</el-button>
        <el-button type="primary" @click="SummaryButton">确 定</el-button>
      </span>
    </el-dialog>

    <!-- 脱敏数据转汇总窗口 -->
    <el-dialog
      title="转汇总"
      :visible.sync="TotalTransferSummary"
      width="30%"
      center
    >
      <el-form
        ref="TotalTransfer"
        :model="TotalTransfer"
        :rules="TotalTransferrules"
        label-width="90px"
        label-position="left"
         @submit.native.prevent
      >
        <el-form-item label="日期选择" prop="field101">
          <el-date-picker
            v-model="TotalTransfer.field101"
            format="yyyy-MM-dd"
            value-format="yyyy-MM-dd"
            :style="{ width: '100%' }"
            placeholder="请选择日期选择"
            :picker-options="pickerOptions0"
            clearable
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="选择" prop="field102">
          <el-select
            filterable
            v-model="TotalTransfer.field102"
            placeholder="请选择"
            style="width: 100%"
            clearable
            multiple
          >
            <el-option
              v-for="(item, index) in selectOptions"
              :key="index"
              :label="item.columnName"
              :value="item.columnKey"
            >
            </el-option>
          </el-select>
        </el-form-item>
      </el-form>

      <span slot="footer" class="dialog-footer">
        <el-button @click="TotalTransferSummary = false">取 消</el-button>
        <el-button type="primary" @click="TotalTransferButton">确 定</el-button>
      </span>
    </el-dialog>

    <!-- 脱敏数据发布窗口 -->
    <el-dialog title="发布" :visible.sync="releaseSummary" width="30%" center>
      <el-form
        ref="releaseData"
        :model="releaseData"
        :rules="releaserules"
        size="medium"
        label-width="90px"
        label-position="left"
         @submit.native.prevent
      >
        <el-form-item label="日期选择" prop="field101">
          <el-date-picker
            v-model="releaseData.field101"
            format="yyyy-MM-dd"
            value-format="yyyy-MM-dd"
            :style="{ width: '100%' }"
            placeholder="请选择日期选择"
            :picker-options="pickerOptions0"
            clearable
          ></el-date-picker>
        </el-form-item>
      </el-form>

      <span slot="footer" class="dialog-footer">
        <el-button @click="releaseSummary = false">取 消</el-button>
        <el-button type="primary" @click="releaseDataButton">确 定</el-button>
      </span>
    </el-dialog>

    <!-- 间联查看上级 弹窗 -->
    <el-dialog
      title="查看上级"
      :visible.sync="SuperiorShow"
      @click="onClose"
      width="30%"
      center
    >
      <!-- <el-row :gutter="18" style="border:1px red solid;display:flex;justify-conten:center"> -->
      <div style="display: flex; justify-content: center">
        <el-steps :active="CheckSuperiorNumber" style="width: 70%">
          <!-- //动态显示最后一个 -->
          <el-step
            v-for="item in CheckSuperiorData"
            :key="item.userId"
            :title="item.userName"
            :description="item.phoneNumber"
          ></el-step>
        </el-steps>
      </div>
      <!-- </el-row> -->
    </el-dialog>

    <!-- 划拨弹窗 -->
    <el-dialog title="划拨" :visible.sync="transferDialogVisible" width="30%" center>
      <el-form
        ref="transferData"
        :model="transferData"
        :rules="transferrules"
        size="medium"
        label-width="100px"
        label-position="left"
      >
        <el-form-item
          label="划拨层级"
          prop="field101"
          v-if="userName != '租户'"
        >
          <el-radio-group
            v-model="transferData.field101"
            @change="transferschange"
            size="medium"
          >
            <el-radio
              v-for="(item, index) in linkOptions"
              :key="index"
              :label="item.value"
              >{{ item.label }}</el-radio
            >
          </el-radio-group>
        </el-form-item>
        <el-form-item label="划拨用户" prop="field102">
          <el-select
            v-model="transferData.field102"
            placeholder="请选择划拨用户"
            clearable
            :style="{ width: '70%' }"
            size="small"
            filterable
          >
            <el-option
              v-for="(item, index) in transferOptions"
              :key="index"
              :label="item.nickName"
              :value="item.userId"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-form>

      <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="transferDialogVisible = false"
          >取 消</el-button
        >
        <el-button size="small" type="primary" @click="singletransfer"
          >确 定</el-button
        >
      </span>
    </el-dialog>
    <!-- 批量划拨弹窗 -->
    <el-dialog title="批量划拨" :visible.sync="drawingVisible" width="30%" center>
      <el-form
        ref="transferData"
        :model="transferData"
        :rules="transferrules"
        size="medium"
        label-width="85px"
        label-position="left"
      >
        <!-- <el-form-item label="划拨条数" prop="field101">
                  <el-input
                    v-model="transferData.field101"
                    placeholder="请输入批量打款条数"
                    :maxlength="15"
                    :disabled="true"
                    clearable
                    size="small"
                    :style="{ width: '70%' }"
                  ></el-input>
                </el-form-item> -->
        <el-form-item
          label="划拨层级"
          prop="field101"
          v-if="userName != '租户'"
        >
          <el-radio-group
            v-model="transferData.field101"
            @change="transferschange"
            size="medium"
          >
            <el-radio
              v-for="(item, index) in linkOptions"
              :key="index"
              :label="item.value"
              >{{ item.label }}</el-radio
            >
          </el-radio-group>
        </el-form-item>
        <el-form-item label="划拨用户" prop="field102">
          <el-select
            v-model="transferData.field102"
            placeholder="请选择划拨用户"
            clearable
            :style="{ width: '100%' }"
           
            filterable
          >
            <el-option
              v-for="(item, index) in transferOptions"
              :key="index"
              :label="item.nickName"
              :value="item.userId"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="上传" prop="field101" required>
          <el-upload
            ref="field106"
            class="upload-demo"
            :action="actionUrl()"
            :file-list="field102fileList"
            :on-change="handleChange2"
            :auto-upload="false"
            accept=".xlsx,.xls"
            :before-upload="field101BeforeUpload"
          >
            <el-button
              size="small"
              type="primary"
              icon="el-icon-upload"
              style="width: 100px"
              >点击上传</el-button
            >
          </el-upload>
        </el-form-item>
        <el-form-item label="下载模板">
          <el-button
            size="small"
            @click="downloadTemplate"
            type="primary"
            style="width: 100px"
            >点击下载</el-button
          >
        </el-form-item>
      </el-form>

      <span slot="footer" class="dialog-footer">
        <el-button @click="drawingVisible = false"
          >取 消</el-button
        >
        <el-button
          :disabled="variable.length <= 0"
          type="primary"
          @click="transferClick"
          >确 定</el-button
        >
      </span>
    </el-dialog>

    <!-- 批量回收弹窗 -->
    <el-dialog title="批量回收" :visible.sync="recoveryVisible" width="30%" center>
      <el-form
        ref="recoveryData"
        :model="recoveryData"
        :rules="recoveryrules"
        size="medium"
        label-width="90px"
        label-position="left"
      >
        <el-form-item label="上传" prop="field101" required>
          <el-upload
            ref="field101"
            class="upload-demo"
            :action="actionUrl()"
            :file-list="field105fileList"
            :on-change="handleChange2"
            :auto-upload="false"
            accept=".xlsx,.xls"
            :before-upload="field101BeforeUpload"
          >
            <el-button
              size="small"
              type="primary"
              icon="el-icon-upload"
              style="width: 100px"
              >点击上传</el-button
            >
          </el-upload>
        </el-form-item>
        <el-form-item label="下载模板">
          <el-button
            size="small"
            @click="downloadTemplate"
            type="primary"
            style="width: 100px"
            >点击下载</el-button
          >
        </el-form-item>
      </el-form>

      <span slot="footer" class="dialog-footer">
        <el-button @click="recoveryVisible = false"
          >取 消</el-button
        >
        <el-button
          :disabled="variable.length <= 0"
          type="primary"
          @click="recoveryClick"
          >确 定</el-button
        >
      </span>
    </el-dialog>

    <!-- 新增弹窗 -->
    <el-dialog title="新增" :visible.sync="addDialogVisible" width="30%" center>
      <el-form
        ref="addrData"
        :model="addrData"
        :rules="addrDatarules"
        size="medium"
        label-width="100px"
        label-position="left"
         @submit.native.prevent
      >
        <el-form-item label="广告位名称" prop="field101">
          <el-input
            size="small"
            v-model.trim="addrData.field101"
            placeholder="请输入广告位名称"
            :maxlength="10"
            clearable
            :style="{ width: '50%' }"
          ></el-input>
        </el-form-item>
      </el-form>

      <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="addDialogVisible = false"
          >取 消</el-button
        >
        <el-button size="small" type="primary" @click="addClick"
          >确 定</el-button
        >
      </span>
    </el-dialog>
    <!-- 上传码弹窗 -->
    <el-dialog title="上传码" :visible.sync="uploadDialogVisible" width="30%" center>
      <el-form
        ref="uploadData"
        :model="uploadData"
        :rules="uploadrules"
        size="medium"
        label-width="90px"
        label-position="left"
         @submit.native.prevent
      >
        <el-form-item label="上传" prop="field101" required>
          <el-upload
            ref="field106"
            class="upload-demo"
            :action="actionUrl()"
            :file-list="field101fileList"
            :on-change="handleChange"
            :auto-upload="false"
            accept=".xlsx,.xls"
            :before-upload="field101BeforeUpload"
          >
            <el-button
              size="small"
              type="primary"
              icon="el-icon-upload"
              style="width: 100px"
              >点击上传</el-button
            >
          </el-upload>
        </el-form-item>
        <el-form-item label="下载模板">
          <el-button
            size="small"
            @click="upltemplate"
            type="primary"
            style="width: 100px"
            >点击下载</el-button
          >
        </el-form-item>
      </el-form>
    </el-dialog>

    <!-- 快速新增弹窗 -->
    <el-dialog
      title="快速新增"
      :visible.sync="fastaddDialogVisible"
      width="30%"
      center
    >
      <el-form
        ref="fastaddrData"
        :model="fastaddrData"
        :rules="fastaddrDatarules"
        size="medium"
        label-width="130px"
        label-position="left"
         @submit.native.prevent
      >
        <el-form-item label="快速新增数量" prop="field101">
          <el-input
            v-model.trim="fastaddrData.field101"
            placeholder="请输入快速新增数量"
            :maxlength="3"
            size="small"
            clearable
            :style="{ width: '50%' }"
          ></el-input>
        </el-form-item>
      </el-form>

      <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="fastaddDialogVisible = false"
          >取 消</el-button
        >
        <el-button size="small" type="primary" @click="fastaddClick"
          >确 定</el-button
        >
      </span>
    </el-dialog>
    <!-- 码设置编辑 -->
    <el-dialog title="编辑" :visible.sync="editVisible" width="30%" center>
      <el-form
        ref="editrData"
        :model="editrData"
        :rules="editrDatarules"
         @submit.native.prevent
        label-width="100px"
        label-position="left"
      >
        <el-form-item :label="mashezhi[2].name" prop="field101">
          <el-input
            v-model.trim="editrData.field101"
            :placeholder="mashezhi[2].name"
            :maxlength="20"
            clearable
            :style="{ width: '100%' }"
          ></el-input>
        </el-form-item>
      </el-form>

      <span slot="footer" class="dialog-footer">
        <el-button @click="editVisible = false">取 消</el-button>
        <el-button type="primary" @click="editSubmitButton"
          >确 定</el-button
        >
      </span>
    </el-dialog>
    <!-- 数据明细和汇总数据编辑 -->
    <el-dialog title="编辑" :visible.sync="editshujuVisible" width="30%" center>
      <el-form :model="editJudge" size="medium" label-width="100px" label-position="left" @submit.native.prevent>
        <el-form-item
          :label="item.name"
          prop="field101"
          v-for="item in editJudge"
          :key="item"
        >
          <el-input
            :type="$route.query.judgeParam=='2'?'number':'text'"
            v-model.trim="item.text"
            placeholder=""
            :maxlength="20"
            clearable
            :style="{ width: '100%' }"
          ></el-input>
          <span v-show="item.text==''" style="color: red; font-size: 14px">
            数据不可为空</span
          >
        </el-form-item>
      </el-form>

      <span slot="footer" class="dialog-footer">
        <el-button @click="editshujuVisible = false"
          >取 消</el-button
        >
        <el-button
          type="primary"
          @click="editshujuButton"
          :disabled="shujuButton"
          >确 定</el-button
        >
      </span>
    </el-dialog>

    <el-card>
      <div slot="header">
        <span
          style="
            display: flex;
            align-items: center;
            font-size: 18px;
            padding-bottom: 2px;
          "
        >
          <img
            src="@/assets/img/scsj.png"
            style="height: 20px; width: 20px; margin-right: 5px"
          />
          {{ htmlName }}-上传数据</span
        >
      </div>
      <div class="xhxBox" style="margin-top: -7px"></div>
      <el-tabs
        v-model="activeName"
        @tab-click="handleClick"
        v-loading="loading"
      >
        <!-- 切换页面头 -->
        <el-tab-pane
          :label="item.configName"
          :name="item.id"
          v-show="
            !divShowData.dataTState &&
            !divShowData.codeState &&
            !divShowData.dataHState &&
            !divShowData.dataTeamState
          "
          v-for="item in listPrasm"
          :key="item.id"
        >
          <span
            slot="label"
            style="font-size: 16px; display: flex; align-items: center"
          >
            <div
              style="margin-top: -2px"
              :class="activeName == item.id ? 'xhxShow' : ''"
            >
              <img
                :src="activeName == item.id ? item.img : item.img2"
                style="width: 16px; height: 16px; margin-right: 5px"
              />
              <span :class="activeName == item.id ? 'textBox2' : 'textBox'">{{
                item.configName
              }}</span>
            </div>
          </span>
        </el-tab-pane>

        <!-- 码设置搜索 -->
        <el-form
          inline
          label-width="auto"
          label-position="left"
          v-show="tebleParam.name == 2 || tebleParam.name == 6"
        >
          <el-form-item :label="mashezhi[0].name">
             <el-date-picker
              v-model="SettingParam.valueTime"
              type="datetimerange"
        
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              align="right"
               style="width: 200px; margin-right: 30px"
              :default-time="['00:00:00', '23:59:59']"
              value-format="yyyy-MM-dd HH:mm:ss"
            >
            </el-date-picker>

            <!-- <el-date-picker
              v-model="SettingParam.valueTime"
              type="daterange"
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              style="width: 200px"
              value-format="yyyy-MM-dd"
              :picker-options="pickerOptions0"
            /> -->
          </el-form-item>
          <!-- <el-form-item label="系统ID" style="margin-right: 40px;margin-left: 40px" label-width="66px">
              <el-input maxlength="20" clearable v-model="SettingParam.id" placeholder="请输入系统ID" style="width: 200px"/>
            </el-form-item> -->
          <el-form-item :label="mashezhi[1].name" style="margin-right: 40px">
            <el-input
              maxlength="100"
              clearable
              v-model="SettingParam.maBiaoShi"
              :placeholder="mashezhi[1].name"
              style="width: 200px"
            />
          </el-form-item>
          <el-form-item :label="mashezhi[2].name" style="margin-right: 40px">
            <el-input
              maxlength="20"
              clearable
              v-model="SettingParam.maName"
              :placeholder="mashezhi[2].name"
              style="width: 200px"
            />
          </el-form-item>
          <el-form-item label="状态" style="margin-right: 30px">
            <el-select
              clearable
              v-model="SettingParam.state"
              placeholder="请选择状态"
              style="width: 200px"
              filterable
            >
              <el-option
                v-for="item in optionssState"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item
            :label="mashezhi[3].name"
            v-if="userName != '用户'"
            style="margin-right: 30px"
          >
            <el-select
              clearable
              v-model="SettingParam.userId"
              :placeholder="mashezhi[3].name"
              style="width: 200px"
              filterable
            >
              <el-option
                v-for="item in optionss"
                :key="item.userId"
                :label="item.nickName"
                :value="item.userId"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <div style="display: flex; justify-content: center">
            <el-button
              icon="el-icon-refresh"
              style="background: #eeeeee; color: #6396f4; font-weight: bold"
              @click="desensitizationReset('teamformData', 4)"
              >重置
            </el-button>
            <el-button
              type="primary"
              icon="el-icon-search"
              @click="switchButton(1)"
              >搜索</el-button
            >
          </div>
        </el-form>
        <div class="xhxBox2" v-show="postData.length > 0"></div>
        <!-- 结果汇总的是否统计显示便签 -->
          <div class="LabelBox" v-show="tebleParam.name == 4 || tebleParam.name == 11|| tebleParam.name == 12|| tebleParam.name == 5|| tebleParam.name == 6|| tebleParam.name == 13">
          <div class="LabelMiniBox">
            <span v-for="tag in postData" :key="tag.name" class="LabelMiniBox_span">
              {{ tag.name }}：
              <span style="color:#1890FF"> {{ tag.statistics }}，</span>
            </span>
          </div>
           <!-- <el-button
            style="background: #eeeeee; color: #6396f4; font-weight: bold;height:37px;"
            @click="handleAdd()"
          >
            <img
              src="@/assets/img/daochu.svg"
              style="
                width: 15px;
                height: 15px;
                margin-right: 5px;
                margin-bottom: -2px;
              "
            />导出
          </el-button> -->
        </div>

        <!-- <div class="LabelBox">
          <el-tag v-for="tag in postData" :key="tag.name" class="LabelMiniBox">
            {{ tag.name }}:{{ tag.statistics }}
          </el-tag>
        </div> -->
        <!-- <div class="xhxBox2" v-show="postData.length > 0"></div> -->
        <!-- 码设置按钮 -->
        <div
          v-show="tebleParam.name == 2 || tebleParam.name == 9"
          style="display: flex; justify-content: space-between; margin: 10px 0"
        >
          <div>
            <el-button
              type="primary"
              @click="uploadDialogVisible = true"
              v-if="userName != '用户'"
              :disabled="buttonShow"
            >
              <img
                src="@/assets/img/shangchuan.png"
                style="
                  width: 15px;
                  height: 15px;
                  margin-right: 5px;
                  margin-bottom: -2px;
                "
              />
              上传码
            </el-button>
            <el-button
              type="primary"
              @click="transfersBotton"
              :disabled="buttonShow"
            >
              <img
                src="@/assets/img/piliang.png"
                style="
                  width: 15px;
                  height: 15px;
                  margin-right: 5px;
                  margin-bottom: -2px;
                "
              />
              批量划拔</el-button
            >
            <el-button
              type="primary"
              v-if="userName != '用户'"
              @click="recoveryVisible = true"
              :disabled="buttonShow"
            >
              <img
                src="@/assets/img/huishou.png"
                style="
                  width: 15px;
                  height: 15px;
                  margin-right: 5px;
                  margin-bottom: -2px;
                "
              />
              批量回收</el-button
            >
            <!-- <el-button
              type="primary"
              v-if="addBottonShow != 0"
              @click="addDialogVisible = true"
              :disabled="buttonShow"
            >
              <img
                src="@/assets/img/xinzeng.png"
                style="
                  width: 15px;
                  height: 15px;
                  margin-right: 5px;
                  margin-bottom: -2px;
                "
              />
              新增</el-button
            > -->
            <!-- <el-button
              type="primary"
              v-if="addBottonShow != 0"
              @click="fastaddDialogVisible = true"
              :disabled="buttonShow"
            >
              <img
                src="@/assets/img/xinzeng.png"
                style="
                  width: 15px;
                  height: 15px;
                  margin-right: 5px;
                  margin-bottom: -2px;
                "
              />
              快速新增</el-button
            > -->
          </div>
          <el-button
            style="background: #eeeeee; color: #6396f4; font-weight: bold"
            @click="mszButton"
          >
            <img
              src="@/assets/img/daochu.svg"
              style="
                width: 15px;
                height: 15px;
                margin-right: 5px;
                margin-bottom: -2px;
              "
            />导出
          </el-button>
        </div>
        <!-- 原始数据按钮 -->
        <div
          v-show="tebleParam.name == 3"
          style="display: flex; justify-content: space-between"
        >
          <div>
            <el-button
              type="primary"
              icon="el-icon-upload2"
              @click="uploadButtonSummary = true"
              style="margin-bottom: 10px"
              >上传</el-button
            >
            <el-button
              type="primary"
              icon="el-icon-download"
              @click="downloadE"
              style="margin-bottom: 10px"
              >下载模板</el-button
            >
            <el-button
              type="primary"
              icon="el-icon-refresh"
              @click="TotalTransferSummaryShow"
              style="margin-bottom: 10px"
              >转汇总</el-button
            >
            <el-button
              type="primary"
              icon="el-icon-s-promotion"
              @click="releaseSummary = true"
              style="margin-bottom: 10px"
              >发布</el-button
            >
          </div>
        </div>
        <!-- 汇总数据按钮 -->
        <div
          v-show="tebleParam.name == 11"
          style="
            display: flex;
            justify-content: space-between;
            margin: 10px 0px 0px 0px;
          "
        >
          <div>
            <el-button
              type="primary"
              icon="el-icon-upload2"
              @click="uploadButtonSummary = true"
              style="margin-bottom: 10px"
              >上传</el-button
            >
            <el-button
              type="primary"
              icon="el-icon-download"
              @click="downloadE"
              style="margin-bottom: 10px"
              >下载模板</el-button
            >
            <el-button
              type="primary"
              icon="el-icon-refresh"
              @click="TotalTransferSummaryShow"
              style="margin-bottom: 10px"
              >汇总</el-button
            >
            <el-button
              type="primary"
              icon="el-icon-s-promotion"
              @click="releaseSummary = true"
              style="margin-bottom: 10px"
              >发布</el-button
            >
          </div>
        </div>

        <el-table
          :data="roleList"
          :header-cell-style="{
            background: '#FAFAFA',
            color: 'black',
            'font-size': 15 + 'px',
            'text-align': 'center',
          }"
          height="650"
        >
          <el-table-column
            @cell-mouse-enter="handleMouseEnter"
            :prop="item2.columnKey"
            :label="item2.columnName"
            align="center"
            v-for="item2 in tableData"
            :key="item2.id"
            :show-overflow-tooltip="true"
          >
            <template slot-scope="scope">
              <span v-if="item2.data == 1">
                <el-popover trigger="hover" placement="top">
                  <vue-qr
                    :text="scope.row[item2.columnKey]"
                    :margin="1"
                    :size="300"
                    style="height: 250px"
                  ></vue-qr>
                  <div slot="reference" class="name-wrapper">
                    <el-tag size="medium">{{
                      scope.row[item2.columnKey]
                    }}</el-tag>
                  </div>
                </el-popover>
              </span>
                 <!-- <span v-else-if="item2.data == 0" @click="copyButton(scope.row[item2.columnKey])">
                {{scope.row[item2.columnKey]}}
               
              </span> -->

              

              <!-- <span v-else-if="item2.columnKey=='id_name'&&activeName=='2'||activeName=='9'"> -->
              <span
                v-else-if="item2.columnKey == 'id_name' && tblName == '码设置'"
              >
                <span>{{ scope.row[item2.columnKey] || "-" }}</span>
                <span
                  ><i
                    @click="mashezhieditBotton(scope.row)"
                    class="el-icon-edit"
                    style="margin-left: 5px; cursor: pointer; color: #538aff"
                  ></i
                ></span>
              </span>
                  <span v-else-if="item2.columnKey == 'user_name'">
                      <el-button
                    type="text"
                    @click="CheckSuperior(scope.row)"
                    style="height: auto; margin: 0px; padding: 0px;text-decoration:underline"
                  >{{ scope.row[item2.columnKey]}}</el-button
                >
                   </span>

              <span v-else-if="scope.row[item2.columnKey] == '0'">{{
                scope.row[item2.columnKey]
              }}</span>
              <!-- <span v-else>{{ scope.row[item2.columnKey] || "-" }}</span> -->
                <span v-else class="tag-read" style="cursor:pointer" :data-clipboard-text="scope.row[item2.columnKey]" @click="copyButton">{{ scope.row[item2.columnKey] || "-" }}</span> 
            </template>
          </el-table-column>
          <!-- 会员汇总操作 -->
          <!-- <el-table-column
            label="操作"
            align="center"
            prop="amount"
            v-if="
              userName != '用户' &&
              !buttonShow &&
              tebleParam.label == '会员汇总'
            "
          >
            <template slot-scope="scope">
              <el-button round type="text" @click="otherExport(scope.row)"
                >查看上级</el-button
              >
            </template>
          </el-table-column> -->
          <!-- 码设置操作 -->
          <el-table-column
            prop="capItemCodePoolBelongingOne"
            label="操作"
            align="center"
            v-if="(!buttonShow && tebleParam.name == 2) || tebleParam.name == 9"
            width="170"
          >
            <template slot-scope="scope">
              <el-button type="text" @click="transferBotton(scope.row)"
                >划拨</el-button
              >
              <el-button
                type="text"
                v-if="userName != '用户'"
                @click="delBotton(scope.row)"
                v-hasPermi="['selfcom:role:edit']"
                >删除</el-button
              >
              <el-button
                type="text"
                v-if="userName != '用户'"
                @click="editBotton(scope.row)"
                v-hasPermi="['selfcom:role:edit']"
                >回收</el-button
              >
            </template>
          </el-table-column>
          <!-- 码设置操作 -->
          <el-table-column
            prop="capItemCodePoolBelongingOne"
            label="操作"
            align="center"
            v-if="
              (!buttonShow && tebleParam.name == 3) || tebleParam.name == 11
            "
            width="170"
          >
            <template slot-scope="scope">
              <el-button type="text" @click="shujueditBotton(scope.row)"
                >编辑</el-button
              >
            </template>
          </el-table-column>

          <!-- 会员汇总和团队汇总操作 -->
          <el-table-column
            label="操作"
            align="center"
            prop="amount"
            v-if="
              tebleParam.name == 5 ||
              tebleParam.name == 12 ||
              tebleParam.name == 6 ||
              tebleParam.name == 13
            "
          >
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="text"
                style="text-decoration: underline"
                @click="otherExport(scope.row)"
                >查看上级</el-button
              >
            </template>
          </el-table-column>
        </el-table>
        <!-- 分页插件 -->
        <pagination
          :total="total"
          style="margin: 40px 0px"
          :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.pageSize"
          @pagination="switchButton"
        />
      </el-tabs>
    </el-card>
       <!-- 查看上级 -->
    <ViewSuperior
      ref="superior"
      :IdData="IdData"
    />
  </div>
</template>

<script>
import { getInfo, getIdentityAndTopId } from "@/api/login.js";
import ViewSuperior from "@/views/components/ViewSuperior.vue";
import VueQr from "vue-qr";
import {
  geteditAPI,
  selectByCodeCondition,
  userNewCode,
  tenantByRecovery,
  userTransfer,
  deleteByIds,
  downLoadFormwork,
  uploadCode,
  transferFormwork,
  uploadtransfer,
  desensitizationAPI,
  dateConditionQueryList,
  selectByProId,
  moreAPI,
  geteditindex,
  exportButton,
  mszexportButton,
  updateByIdName,
  uploadlaxisDate,
  hzuploadlDate,
  totalTransfer,
  release,
  totalTransferSum,
  selectSumByKey,
  updateDataById,
} from "@/api/projectManagement/index.js";
import Clipboard from 'clipboard';  
import {
  selectUserGroupRelaList,
  selectBySuperior,
  selectByHierarchy,
} from "@/api/base/index.js";
export default {
  components: { VueQr,ViewSuperior},
  data() {
    return {
        //时间选择器的快捷选择
      pickerOptions: {
        shortcuts: [
          {
            text: "最近一周",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
              picker.$emit("pick", [start, end]);
            },
          },
          {
            text: "最近一个月",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
              picker.$emit("pick", [start, end]);
            },
          },
          {
            text: "最近三个月",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
              picker.$emit("pick", [start, end]);
            },
          },
        ],
      },
       //查看上级组件参数
     IdData:"",
      //汇总数据和数据明细弹窗编辑
      editshujuVisible: false,
      editJudge: [],
      // 结果汇总是否统计标签参数
      postData: [
        //  {name:"1"}
      ],
      tblName: "", //判断表格里面是否显示编辑按钮
      releaseSummary: false,
      //脱敏数据转汇总弹窗里面得多选下拉框
      selectOptions: [],
      TotalTransferSummary: false,
      field103fileList: [],
      loading: true,
      //码设置编辑弹窗
      editVisible: false,
      //码设置编辑参数
      editrData: {
        field101: "",
        id: "",
      },
      //所有搜索名称
      // mashezhi[3].name    用户昵称
      // mashezhi[0].name    时间
      // mashezhi[4].name  系统ID
      // mashezhi[1].name    识别号
      // mashezhi[2].name    码名称
      mashezhi: [
        { name: "" },
        { name: "" },
        { name: "" },
        { name: "" },
        { name: "" },
        { name: "" },
      ],

      //如果为码池分权模式那么就显示快速新增和新增按钮
      addBottonShow: 0,
      listPrasm: [],

      //判断表头切换页面是否显示
      divShowData: {},
      //如果表头获取为空，那么所有操作和按钮都不显示或禁用
      buttonShow: false,
      //查看上级数据参数
      CheckSuperiorData: [
        // {userName:"111",phoneNumber:"15555555555"},
      ],
      // 查看上级数据显示的最后一位
      CheckSuperiorNumber: "",
      //查看上级弹窗
      SuperiorShow: false,

      aaa: true,
      // 向上向下单选框
      linkOptions: [
        {
          label: "向上划拨",
          value: 4,
        },
        {
          label: "向下划拨",
          value: 1,
        },
      ],
      //批量划拨上传
      field102fileList: [],
      //批量回收

      recoveryVisible: false,
      // 批量回收上传
      field105fileList: [],
      //批量回收参数
      recoveryData: {
        field101: 0,
        field102: undefined,
      },
      //批量回收必填
      recoveryrules: {
        field101: [
          {
            required: true,
            message: "请输入识别名称",
            trigger: "blur",
          },
        ],
        field102: [
          {
            required: true,
            message: "请选择划拨用户",
            trigger: "change",
          },
        ],
      },
      //码设置搜索的状态
      optionssState: [
         { value: undefined, label: "全部" },
        { value: 1, label: "使用" },
        { value: 0, label: "未使用" },
      ],
      // 下拉框
      optionss: [{ value: 1, label: "1" }],
      //批量划拨弹窗
      drawingVisible: false,
      //识别码合并数据
    
      //全选取消全选
      checkBox: 0,
      //上传码弹窗
      uploadDialogVisible: false,
      uploadData: {
        field101: null,
      },
      uploadrules: {},
      field101Action: "https://jsonplaceholder.typicode.com/posts/",
      field101fileList: [],
      //快速新增弹窗参数
      fastaddDialogVisible: false,
      fastaddrData: {
        field101: "",
      },
      fastaddrDatarules: {
        field101: [
          {
            required: true,
            message: "请输入新增数量",
            trigger: "change",
          },
          {
            pattern: /^\d+$/,
            message: "格式错误",
            trigger: "change",
          },
        ],
      },
      //新增弹窗参数
      addDialogVisible: false,
      addrData: {
        field101: "",
      },
      addrDatarules: {
        field101: [
          {
            required: true,
            message: "请输入广告位名称",
            trigger: "change",
          },
        ],
      },
      editrDatarules: {
        field101: [
          {
            required: true,
            message: "不可为空",
            trigger: "change",
          },
        ],
      },
      //分页
      total: 0,
      queryParams: {
        pageSize: 10,
        pageNum: 1,
      },
      //划拨弹窗参数
      transferDialogVisible: false,

      transferData: {
        field101: 1,
        field102: undefined,
      },
      transferrules: {
        field101: [
          {
            required: true,
            message: "请输入识别名称",
            trigger: "blur",
          },
        ],
        field102: [
          {
            required: true,
            message: "请选择划拨用户",
            trigger: "change",
          },
        ],
      },
      transferOptions: [
        {
          label: "选项一",
          value: 1,
        },
        {
          label: "选项二",
          value: 2,
        },
      ],
      // 当前用户ID
      userId: 0,
      // 码设置搜索
      SettingParam: {
        valueTime: [],
        cTime: "",
        eTime: "",
        id: "", //系统ID
        maBiaoShi: "", //广告位名称
        maLianJie: "", //广告位链接
        maName: "",
        proId: "",
        pageNum: 1,
        pageSize: 10,
        state: undefined, //已使用1,0未分配
        wbList: [], //文本集合
        userId: "", //归属人
      },
      // 表格
      tableData: [
        // { code: "2", remark: false }
      ],
      roleList: [{ link_5d: "2", id_name: 4 }],
      //租户还是用户
      userName: "",
      //
      //码汇总数据上传弹窗
      uploadButtonSummary: false,
      //码汇总数据上传弹窗参数
      Summary: {
        field104: null,
        field102: undefined,
        field103: null,
      },
      Summaryrules: {
        field104: [
          {
            required: true,
            message: "请选择日期选择",
            trigger: "change",
          },
        ],
        field102: [
          {
            required: true,
            message: "请选择下拉选择",
            trigger: "change",
          },
        ],
      },
      Summaryptions: [
        {
          label: "选项一",
          value: 1,
        },
        {
          label: "选项二",
          value: 2,
        },
      ],
      releaserules: {
        field101: [
          {
            required: true,
            message: "请选择日期",
            trigger: "change",
          },
        ],
      },
      //脱敏数据转汇总弹窗
      TotalTransferShow: false,
      TotalTransferrules: {
        field101: [
          {
            required: true,
            message: "请选择日期选择",
            trigger: "change",
          },
        ],
        field104: [
          {
            required: true,
            message: "请选择日期选择",
            trigger: "change",
          },
        ],
        field102: [
          {
            required: true,
            message: "请选择下拉选择",
            trigger: "change",
          },
        ],
      },
      TotalTransfer: {
        field101: null,
        field102: undefined,
        field103: null,
        field104: null,
        field105: null,
        field106: null,
        field107: null,
      },

      formData: {
        field102: [],
        field103: "",
        field104: "",
        field105: "",
        field106: "",
      },
      //会员汇总数据搜索
      memberformData: {
        field102: [],
        field103: "",
      },
      //团队汇总数据搜索
      teamformData: {
        field102: [],
        field103: "",
      },
      //码汇总数据搜索
      summaryformData: {
        field102: [],
        field103: "",
        field104: "",
        field105: "",
        field106: "",
      },

      rules: {
        field102: [],
        field103: [],
        field104: [],
        field105: [],
      },
      pickerOptions0: {
        disabledDate(time) {
          return time.getTime() > Date.now() - 8.64e6;
        },
      },
      pdfUrl: "",
      // 切换佣金收入和分润收入
      activeName: "2",
      // ..提现弹窗
      centerDialogVisible: false,
      // ..提现窗口3个数据
      ruleForm: {
        money: "",
        region: "",
        date2: "",
        monetUser: "",
      },
      //脱敏数据发布
      releaseData: {
        field101: "",
      },
      // ..卡片总数据
      CardData: {},
      rules: {
        money: [{ required: true, message: "请输入提现金额", trigger: "blur" }],
        region: [
          { required: true, message: "请选择提现类型", trigger: "change" },
        ],
        monetUser: [
          { required: true, message: "请选择提现账号", trigger: "blur" },
        ],
      },
      // ..提现账号下拉框数据
      monetUser: [],
      // 用户ID
      userId: 0,
      // 类型搜索
      field101Options: [],
      //其它搜索类型
      otherOptions: [
        {
          proName: "平台减少",
          proId: 4,
        },
        {
          proName: "平台增加",
          proId: 3,
        },
      ],
      // 遮罩层
      loading: true,
      // 显示搜索条件
      showSearch: true,
      // 分页总条数
      total: 0,
      // 收入表格数据
      noticeList: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        // 搜索类型
        amountType: "",
        // 时间
        dateRange: "",
        //出资方
        fromUserName: "",
        field106: "",
        field104: "",
      },
      //上传文件的参数
      fileList: [],
      //临时变量
      temporary: null,
      //批量划拨保存的数组
      variable: [],

      tebleParam: {
        name: "",
        label: "",
      },
    };
  },
  async mounted() {
    // 获取userID
    this.userId = sessionStorage.getItem("userID") - 0;
    //  //获取是租户还是用户还是平台
    const { data } = await getIdentityAndTopId();
    console.log(data, "用户信息平台还是租户");
    //如果是用户就调函数
    switch (data.identity) {
      case "用户":
        this.divShow();
        break;
    }
    this.userName = data.identity;
    this.htmlName = this.$route.query.proName;
  //           this.SettingParam.valueTime[0]=this.moment().format('YYYY')+'-'+this.moment().format('MM')+'-'+"01"+""+"00:00:00";
  // this.SettingParam.valueTime[1]=this.moment().format('YYYY-MM-DD')+""+"23:59:59";
    this.getParam();
    //如果为码池分权模式那么就显示快速新增和新增按钮
    this.ShowAddButton();
    //  this.handleQuery();//重新刷新页面，不然页面一进来必须点击码设置才能正常现实数据
  },
  methods: {
     // 点击复制案件
    copyButton(row){
       var clipboard = new Clipboard('.tag-read')  
          clipboard.on('success', e => {  
              this.$message({
          message: '复制成功!',
          type: 'success'
        });
            // success("复制成功");//这里你如果引入了elementui的提示就可以用，没有就注释即可
                  // 释放内存  
                  clipboard.destroy()  
                })  
                clipboard.on('error', e => {  
                  // 不支持复制  
                  console.log('该浏览器不支持自动复制')  
                  // 释放内存  
                  clipboard.destroy()  
                }) 
      },
       // 点击查看上级按钮
     async CheckSuperior(row) {

       this.IdData=row.user_id - 0;
        this.$refs.superior.gitData();
    },
    //数据明细和汇总数据编辑确定按钮
    async editshujuButton() {
      console.log(this.editJudge, "确定按钮");
      let aa={};
      this.editJudge.map(item=>{
        aa[item.key]=item.text;
        
      });
      aa.id=this.editJudge[0].id;
      let param = {
        proId: this.$route.query.proId - 0,
        type: this.$route.query.judgeParam - 0,
        map:aa
      };
        console.log(param,'222')
      const data = await updateDataById(param);
       console.log(data,'1111');
       if(data.code==200){
             this.$message({
          message: '操作成功!',
          type: 'success'
        });
        this.editshujuVisible=false;
         this.switchButton();
       }else{
           this.$message.error(data.msg);
       }
    },
    //数据明细和汇总数据编辑按钮
    shujueditBotton(row) {
      this.editJudge = [];
      console.log(row, "666");
      // console.log(this.tableData, "666");

      //
      this.tableData.map((item, index) => {
        if (item.columnKey.substr(0, item.columnKey.length - 7) == "judge"||item.columnKey.substr(0, item.columnKey.length - 7) =='result') {
          // console.log(item, "555");
          this.editJudge.push({
            name: item.columnName,
            key: item.columnKey,
            text: "",
            id: row.id,
          });
        }
      });

      // console.log(this.editJudge);
      this.editJudge.map((item, index) => {
        for (var i in row) {
          if (i == item.key) {
            console.log(i, "666");
            console.log(this.editJudge[index], "77666");
            this.editJudge[index].text = row[i];
          }
        }
      });

      this.editshujuVisible = true;
    },
    //一进来就执行切换页面头
    async getParam() {
      
      const more = await moreAPI({
        projectTypeId: this.$route.query.judgeParam - 0,
      });
      if (more.code == 200) {
        more.data.forEach((item, index) => {
          if (item.configKey == "authority") {
            more.data.splice(index, 1);
          }
        });
        this.listPrasm = more.data;
        console.log(this.listPrasm, "111222");

        this.listPrasm.forEach((item) => {
          if (item.configKey == "code") {
            this.activeName = item.id + ""; //页面一进来，就把码设置的id放到切换页面参数上，这样就算id变了，也能保证每次进来都显示码设置的页面
            this.tblName = "码设置"; //如果是码设置，那么表格里面就显示编辑按钮，不是码设置就不显示.
            item.img = require("@/assets/img/mashezhi.png");
            item.img2 = require("@/assets/img/mashezhi2.png");
          } else if (item.configKey == "summary") {
            item.img = require("@/assets/img/huizongshuju.png");
            item.img2 = require("@/assets/img/huizongshuju2.png");
          } else if (item.configKey == "vipSummary") {
            item.img = require("@/assets/img/huiyuanhuizong.png");
            item.img2 = require("@/assets/img/huiyuanhuizong2.png");
          } else if (item.configKey == "teamSummary") {
            item.img = require("@/assets/img/tuanduihuizong.png");
            item.img2 = require("@/assets/img/tuanduihuizong2.png");
          } else {
            item.img = require("@/assets/img/yuanshi.png");
            item.img2 = require("@/assets/img/yuanshi2.png");
          }
        });
        this.handleClick1({
          name: this.listPrasm[0].id,
          label: this.listPrasm[0].configName,
        });
      }
    },
    //转汇总确定按钮
    TotalTransferButton() {
      this.$refs["TotalTransfer"].validate(async (valid) => {
        if (valid) {
          let param = {
            proId: this.$route.query.proId - 0, //项目ID
            businessTime: this.TotalTransfer.field101, //时间
            // businessTime:"2021-03-03",  //时间
            keyList: this.TotalTransfer.field102, //多选下拉框
            userId: sessionStorage.getItem("userID") - 0, //用户ID
          };
          if (this.$route.query.judgeParam == "2") {
            console.log(param, "后端的参数");
            let data = await totalTransferSum(param);
            console.log(data, "汇总数据转汇总");
            if (data.code == 200) {
              this.TotalTransferSummary = false;
              this.$message({
                message: "操作成功!",
                type: "success",
              });
              this.switchButton(); //更新页面
            }
          } else {
            let data = await totalTransfer(param);
            console.log(data, "转汇总");
            if (data.code == 200) {
              this.TotalTransferSummary = false;
              this.$message({
                message: "操作成功!",
                type: "success",
              });
              this.switchButton(); //更新页面
            }
          }
        }
      });
      // this.TotalTransfer.field101;
    },
    //脱敏数据-转汇总弹窗
    async TotalTransferSummaryShow() {
      let param = {};
      if (this.$route.query.judgeParam - 0 == 1) {
        param = {
          elementType: "int",
          elementName: "结果汇总",
          configTypeId: 4, //3等于是原始数据得typeID
          projectId: this.$route.query.proId - 0, //项目ID
        };
      } else {
        param = {
          elementType: "double",
          elementName: "计算汇总",
          configTypeId: 11, //3等于是原始数据得typeID
          projectId: this.$route.query.proId - 0, //项目ID
        };
      }

      const data = await geteditAPI(param);
      console.log(data, "转汇总下拉框");
      if (data.code == 200) {
        this.selectOptions = data.data;
      }
      this.TotalTransferSummary = true;
    },
    //脱敏数据-下载模板
    async downloadE() {
      let param = {};
      //如果是汇总
      if (this.$route.query.judgeParam - 0 == 2) {
        param = {
          proId: this.$route.query.proId - 0,
          configTypeId: 11,
        };
      } else {
        //如果是脱敏
        param = {
          proId: this.$route.query.proId - 0,
          configTypeId: 3,
        };
      }
      console.log(param, "下载模板给后端传递的值");
      const res = await downLoadFormwork(param);

      var downloadUrl = window.URL.createObjectURL(res); //转换
      //添加一个a标签，利用a标签打开表格
      var anchor = document.createElement("a");
      anchor.href = downloadUrl;
      anchor.download = decodeURI("模板.xlsx");
      anchor.click();
    },
    //码设置编辑确定按钮
    editSubmitButton() {
      this.$refs["editrData"].validate(async (valid) => {
        if (valid) {
          let param = {
            proId: this.$route.query.proId - 0,
            id: this.editrData.id,
            idName: this.editrData.field101,
          };
          const data = await updateByIdName(param);
          if (data.code == 200) {
            this.$message({
              message: "编辑成功!",
              type: "success",
            });
            this.editVisible = false;
            this.editrData.field101 = "";
            this.switchButton(); //更新页面
          } else {
            this.$message.error("操作失败!");
          }
          console.log(data, "回调");
        }
      });
    },
    mashezhieditBotton(row) {
      console.log(row, "码设置编辑");
      this.editrData.id = row.id;
      this.editVisible = true;
    },
    // 其他导出
    async handleAdd(typeId) {
      // console.log(this.tableData[0].configTypeId,'66666');
      let param = {};
      if (typeId == 2) {
        if (this.userName == "用户") {
          param = {
            type: typeId,
            proId: this.$route.query.proId - 0,
            cTime: this.summaryformData.field102[0] || undefined,
            eTime: this.summaryformData.field102[1] || undefined,
            uuid: this.summaryformData.field104 || undefined, //识别号
            userId: this.userId, //用户昵称
            idName: this.summaryformData.field106 || undefined, //码名称
            id: this.formData.field103 || undefined, //系统ID
            flag: 1, //固定的值
            configTypeId: this.tableData[0].configTypeId,
          };
        } else {
          param = {
            type: typeId,
            proId: this.$route.query.proId - 0,
            cTime: this.summaryformData.field102[0] || undefined,
            eTime: this.summaryformData.field102[1] || undefined,
            uuid: this.summaryformData.field104 || undefined, //识别号
            userId: this.summaryformData.field105 || undefined, //用户昵称
            idName: this.summaryformData.field106 || undefined, //码名称
            id: this.formData.field103 || undefined, //系统ID
            flag: 1, //固定的值
            configTypeId: this.tableData[0].configTypeId,
          };
        }
      } else if (typeId == 1) {
        if (this.userName == "用户") {
          param = {
            type: typeId,
            proId: this.$route.query.proId - 0,
            cTime: this.summaryformData.field102[0] || undefined,
            eTime: this.summaryformData.field102[1] || undefined,
            uuid: this.summaryformData.field104 || undefined, //识别号
            userId: this.userId, //用户昵称
            idName: this.summaryformData.field106 || undefined, //码名称
            id: this.summaryformData.field103 || undefined, //系统ID
            flag: 1, //固定的值
            configTypeId: this.tableData[0].configTypeId,
          };
        } else {
          param = {
            type: 1,
            proId: this.$route.query.proId - 0,
            cTime: this.summaryformData.field102[0] || undefined,
            eTime: this.summaryformData.field102[1] || undefined,
            uuid: this.summaryformData.field104 || undefined, //识别号
            userId: this.summaryformData.field105 || undefined, //用户昵称
            idName: this.summaryformData.field106 || undefined, //码名称
            id: this.summaryformData.field103 || undefined, //系统ID
            flag: 1, //固定的值
            configTypeId: this.tableData[0].configTypeId,
          };
        }
      } else if (typeId == 3) {
        if (this.userName == "用户") {
          param = {
            type: typeId,
            proId: this.$route.query.proId - 0,
            cTime: this.memberformData.field102[0] || undefined,
            eTime: this.memberformData.field102[1] || undefined,
            userId: this.userId, //用户昵称
            id: this.formData.field103 || undefined, //系统ID
            flag: 1, //固定的值
            configTypeId: this.tableData[0].configTypeId,
          };
        } else {
          param = {
            type: typeId,
            proId: this.$route.query.proId - 0,
            cTime: this.memberformData.field102[0] || undefined,
            eTime: this.memberformData.field102[1] || undefined,
            userId: this.memberformData.field103 || undefined, //用户昵称
            id: this.formData.field103 || undefined, //系统ID
            flag: 1, //固定的值
            configTypeId: this.tableData[0].configTypeId,
          };
        }
      } else if (typeId == 4) {
        if (this.userName == "用户") {
          param = {
            type: typeId,
            proId: this.$route.query.proId - 0,
            cTime: this.teamformData.field102[0] || undefined,
            eTime: this.teamformData.field102[1] || undefined,
            userId: this.userId, //用户昵称
            flag: 1,
            configTypeId: this.tableData[0].configTypeId,
          };
        } else {
          param = {
            type: typeId,
            proId: this.$route.query.proId - 0,
            cTime: this.teamformData.field102[0] || undefined,
            eTime: this.teamformData.field102[1] || undefined,
            userId: this.teamformData.field103 || undefined, //用户昵称
            flag: 1,
            configTypeId: this.tableData[0].configTypeId,
          };
        }
      }
      const res = await exportButton(param); //这是后端的接口
      var downloadUrl = window.URL.createObjectURL(res); //转换
      //添加一个a标签，利用a标签打开表格
      var anchor = document.createElement("a");
      anchor.href = downloadUrl;
      anchor.download = decodeURI("表格.xlsx");
      anchor.click();
    },
    // 码设置导出
    async mszButton() {
      //     console.log(this.activeName,'导出')
      // console.log(this.listPrasm,'导出2');
      let dcName=[
      {configName:"表格"}
      ];
       dcName=this.listPrasm.filter(item=>item.id==this.activeName);
      let param = {};
    
      if (this.$route.query.judgeParam=='2') {
             param = {
          proId: this.$route.query.proId - 0, //项目ID
          // uuid: this.SettingParam.maBiaoShi || undefined, //识别号
          // idName: this.SettingParam.maName || undefined, // 广告位名称
          // state: this.SettingParam.state, //状态
          // userId: this.SettingParam.userId || undefined, //归属人ID
          configTypeId: this.tableData[0].configTypeId,
        };
      } else {
            param = {
          proId: this.$route.query.proId - 0, //项目ID
          // cTime: this.SettingParam.valueTime[0] || undefined, //开始时间
          // eTime: this.SettingParam.valueTime[1] || undefined, //结束时间
          // uuid: this.SettingParam.maBiaoShi || undefined, //识别号
          // idName: this.SettingParam.maName || undefined, // 广告位名称
          // state: this.SettingParam.state, //状态
          // userId: this.SettingParam.userId || undefined, //归属人ID
          configTypeId: this.tableData[0].configTypeId,
        };
      };
      // console.log(param,'导出123123')
      const res = await mszexportButton(param);
      var downloadUrl = window.URL.createObjectURL(res); //转换
      //添加一个a标签，利用a标签打开表格
      var anchor = document.createElement("a");
      anchor.href = downloadUrl;
      anchor.download = decodeURI(dcName[0].configName+".xlsx");
      anchor.click();
    },

    // -----------------------------------------
    //如果为码池分权模式那么就显示快速新增和新增按钮
    async ShowAddButton() {
      const getdata = await geteditindex(this.$route.query.proId);
      if (getdata.code == 200) {
        this.addBottonShow = getdata.data.codeType;
        //项目模式 0划拨 1分权模式
      }
    },
    // 接收动态表头公用一个函数
    async common(proId, TypeId) {
      //获取表头
      const getedit = await geteditAPI({
        projectId: proId,
        configTypeId: TypeId,
      });
      console.log(getedit, "获取的元素222");
      if (getedit.code == 200) {
        if (getedit.data.length > 0) {
          getedit.data.forEach((item) => {
            // 先筛选出需要搜索的内容，让表头和搜索名一致
            // mashezhi[3].name    用户昵称
            // mashezhi[0].name    时间
            // mashezhi[4].name  系统ID
            // mashezhi[1].name    识别号
            // mashezhi[2].name    码名称
            // mashezhi[5].name    展业时间
            if (item.columnKey == "upload_time") {
          
            
              this.mashezhi[0].name = item.columnName;
                console.log(  this.mashezhi[0].name,'5')
            } else if (item.columnKey == "uuid") {
              this.mashezhi[1].name = item.columnName;
            } else if (item.columnKey == "id_name") {
              this.mashezhi[2].name = item.columnName;
            } else if (item.columnKey == "user_name") {
              this.mashezhi[3].name = item.columnName;
            } else if (item.columnKey == "id") {
              this.mashezhi[4].name = item.columnName;
            } else if (item.columnKey == "business_time") {
              this.mashezhi[5].name = item.columnName;
            }
          
            //key包含link 那么就转换data
            if (item.columnKey.match("link")) {
              if (item.data != "") {
                const QRcode = JSON.parse(item.data);
                if (QRcode.QRcode != undefined) {
                  item.data = QRcode.QRcode;
                }
              }
            }
          });
           
          this.tableData = getedit.data;
        } else {
           this.tableData = [];
          // this.tableData = [{ columnName: "" }];
          this.buttonShow = true;
          console.log(this.tableData.length, "09089089089089");
        }
      }
    },
    //发布按钮
    releaseDataButton() {
      this.$refs["releaseData"].validate(async (valid) => {
        if (valid) {
          // this.releaseData.field101
          let param = {
            proId: this.$route.query.proId - 0, //项目ID
            businessTime: this.releaseData.field101, //时间
            proTypeId: this.$route.query.judgeParam - 0,
          };
          const data = await release(param);
          console.log(data, "发布");
          if (data.code == 200) {
            this.releaseSummary = false;
            this.$message({
              message: "操作成功!",
              type: "success",
            });
            this.switchButton(); //更新页面
          }
        }
      });
    },
    //码设置列表
    async CodeSetting(name, id) {
       
      this.postData = []; //初始化一下，不然会不停的添加
      let param = {};
      let postParam = {
        proId: this.$route.query.proId - 0,
        configTypeId: id,
        flag: 0,
      };
       
       if(!this.SettingParam.valueTime){
         this.SettingParam.valueTime=[];
      }
     
      // 码设置2-9 ==展业连接
      // 团队汇总6-13
      // 会员汇总5-12
      // 脱敏汇总4  ==数据汇总
      //原始数据 3  ==数据明细
      //汇总数据11
      //数据汇总4
      if (id == 4 || id == 11) {
         
        //脱敏汇总和汇总数据
        param = {
          type: 2,
          proId: this.$route.query.proId - 0,
          pageNum: this.queryParams.pageNum,
          pageSize: this.queryParams.pageSize,
          flag: 0, //固定的值
        };
        const data2 = await dateConditionQueryList(param);
        console.log(data2, "码汇总数据表格");
        //循环出percentage的属性，然后转换为百分比
        data2.data.list.forEach((item) => {
          for (var population in item) {
            if (population.match("percentage")) {
              item[population] = item[population] * 100 + "%"; //成功率转换为%
            }
          }
        });
        if (data2.code == 200) {
          this.roleList = data2.data.list;
          this.total = data2.data.total;
        }
      } else if (id == 5 || id == 12) {
       
        param = {
          type: 3,
          proId: this.$route.query.proId - 0,
          pageNum: this.queryParams.pageNum,
          pageSize: this.queryParams.pageSize,
          flag: 0, //固定的值
        };
        const data3 = await dateConditionQueryList(param);

        console.log(data3, "会员汇总数据表格");
        //循环出percentage的属性，然后转换为百分比
        data3.data.list.forEach((item) => {
          for (var population in item) {
            if (population.match("percentage")) {
              item[population] = item[population] * 100 + "%"; //成功率转换为%
            }
          }
        });
        if (data3.code == 200) {
          this.roleList = data3.data.list;
          this.total = data3.data.total;
        }
      } else if (id == 6 || id == 13) {
        if(this.$route.query.judgeParam=='2'){
            postParam = {
          proId: this.$route.query.proId - 0,
          configTypeId: id,
          flag: 0,
          uuid: this.SettingParam.maBiaoShi || undefined, //识别号
          idName: this.SettingParam.maName || undefined, // 广告位名称
          state: this.SettingParam.state, //状态
          userId: this.SettingParam.userId || this.userId, //归属人ID //用户昵称   //团队汇总的话，结果汇总统计便签需要添加用户id
        };
        param = {
          type: 4,
          proId: this.$route.query.proId - 0,
          pageNum: this.queryParams.pageNum,
          pageSize: this.queryParams.pageSize,
          flag: 0,
          uuid: this.SettingParam.maBiaoShi || undefined, //识别号
          idName: this.SettingParam.maName || undefined, // 广告位名称
          state: this.SettingParam.state, //状态
          userId: this.SettingParam.userId || undefined, //归属人ID
        };
        }else{
            
            postParam = {
          proId: this.$route.query.proId - 0,
          configTypeId: id,
          flag: 0,
          cTime: this.SettingParam.valueTime[0] || undefined, //开始时间
          eTime: this.SettingParam.valueTime[1] || undefined, //结束时间
          uuid: this.SettingParam.maBiaoShi || undefined, //识别号
          idName: this.SettingParam.maName || undefined, // 广告位名称
          state: this.SettingParam.state, //状态
          userId: this.SettingParam.userId || this.userId, //归属人ID //用户昵称   //团队汇总的话，结果汇总统计便签需要添加用户id
        };
        param = {
          type: 4,
          proId: this.$route.query.proId - 0,
          pageNum: this.queryParams.pageNum,
          pageSize: this.queryParams.pageSize,
          flag: 0,
          cTime: this.SettingParam.valueTime[0] || undefined, //开始时间
          eTime: this.SettingParam.valueTime[1] || undefined, //结束时间
          uuid: this.SettingParam.maBiaoShi || undefined, //识别号
          idName: this.SettingParam.maName || undefined, // 广告位名称
          state: this.SettingParam.state, //状态
          userId: this.SettingParam.userId || undefined, //归属人ID
        };
        }
     
        const data4 = await dateConditionQueryList(param);
        console.log(data4, "团队汇总数据表格");
        //循环出percentage的属性，然后转换为百分比
        data4.data.list.forEach((item) => {
          for (var population in item) {
            if (population.match("percentage")) {
              item[population] = item[population] * 100 + "%"; //成功率转换为%
            }
          }
        });
        if (data4.code == 200) {
          this.roleList = data4.data.list;
          this.total = data4.data.total;
        }
      } else if (id == 2 || id == 9) {
      
           
        if(this.$route.query.judgeParam=='2'){
          
             param = {
          pageNum: this.queryParams.pageNum,
          pageSize: this.queryParams.pageSize,
          proId: this.$route.query.proId, //项目ID
          uuid: this.SettingParam.maBiaoShi || undefined, //识别号
          idName: this.SettingParam.maName || undefined, // 广告位名称
          state: this.SettingParam.state, //状态
          userId: this.SettingParam.userId || undefined, //归属人ID
        };
        }else{
             param = {
          pageNum: this.queryParams.pageNum,
          pageSize: this.queryParams.pageSize,
          proId: this.$route.query.proId, //项目ID
          cTime: this.SettingParam.valueTime[0] || undefined, //开始时间
          eTime: this.SettingParam.valueTime[1] || undefined, //结束时间
          uuid: this.SettingParam.maBiaoShi || undefined, //识别号
          idName: this.SettingParam.maName || undefined, // 广告位名称
          state: this.SettingParam.state, //状态
          userId: this.SettingParam.userId || undefined, //归属人ID
        };
        }
       
        console.log(param, "传输数据");
        const dataList = await selectByCodeCondition(param);

        console.log(dataList, "表格");

        //循环出percentage的属性，然后转换为百分比
        dataList.data.list.forEach((item) => {
          for (var population in item) {
            if (population.substr(0, population.length - 7) == "percentage") {
              console.log(item[population], "555");
              item[population] = item[population] * 100 + "%"; //成功率转换为%
            }
          }
        });
        //  console.log(this.tableData,'表头')
        if (dataList.code == 200) {
          dataList.data.list.forEach((item) => {
            if (item.state == 1) {
              item.state = "使用";
            } else {
              item.state = "未使用";
            }
          });
          this.total = dataList.data.total;
          this.roleList = dataList.data.list;
        }
      } else {
        param = {
          type: 1,
          proId: this.$route.query.proId - 0,
          pageNum: this.queryParams.pageNum,
          pageSize: this.queryParams.pageSize,
          flag: 0, //固定的值
        };
        const data = await dateConditionQueryList(param);
        console.log(data, "脱敏数据表格");
        //循环出percentage的属性，然后转换为百分比
        data.data.list.forEach((item) => {
          for (var population in item) {
            if (population.match("percentage")) {
              item[population] = item[population] * 100 + "%"; //成功率转换为%
            }
          }
        });
        if (data.code == 200) {
          this.roleList = data.data.list;
          this.total = data.data.total;
        }
      }

      // 获取脱敏汇总的是否统计数据
      //0未发布1是发布，未发布就是上传数据页面，发布就是数据展示页面，可以理解为传死数据就行

      const statisticsData = await selectSumByKey(postParam);
      if (statisticsData.code == 200 && statisticsData.data) {
        for (let i in statisticsData.data) {
          let o = {};
          o.name = i;
          o.statistics = statisticsData.data[i];
          this.postData.push(o);
        }
      }
      this.loading = false;
    },

    //更新页面函数
    switchButton(row) {
     
      this.handleClick1({
        name: this.tebleParam.name,
        label: this.tebleParam.label,
      });
        if(row){
         this.$message({
          message: '搜索中...',
          type: 'success'
        });
      }
    },
    //切换按钮
    handleClick(tab) {
      this.queryParams.pageSize = 10;
      this.queryParams.pageNum = 1;
      //码汇总数据搜索
      this.summaryformData = {
        field102: [],
        field103: "",
        field104: "",
        field105: "",
        field106: "",
      };
      // 码设置搜索
      this.SettingParam = {
        valueTime: [],
        cTime: "",
        eTime: "",
        id: "", //系统ID
        maBiaoShi: "", //广告位名称
        maLianJie: "", //广告位链接
        maName: "",
        proId: "",
        pageNum: 1,
        pageSize: 10,
        state: undefined, //已使用1,0未分配
        wbList: [], //文本集合
        userId: "", //归属人
      };
      this.formData = {
        field102: [],
        field103: "",
        field104: "",
        field105: "",
        field106: "",
      };
      //会员汇总数据搜索
      this.memberformData = {
        field102: [],
        field103: "",
      };
      //团队汇总数据搜索
      this.teamformData = {
        field102: [],
        field103: "",
      };
      this.TotalTransfer = {
        field101: null,
        field102: undefined,
        field103: null,
        field104: null,
        field105: null,
        field106: null,
        field107: null,
      };
  //              this.SettingParam.valueTime[0]=this.moment().format('YYYY')+'-'+this.moment().format('MM')+'-'+"01"+""+"00:00:00";
  // this.SettingParam.valueTime[1]=this.moment().format('YYYY-MM-DD')+""+"23:59:59";
      this.handleClick1(tab);
    },
    //切换按钮
    async handleClick1(tab, event) {
      console.log(tab.name, "切换按钮");
      console.log(tab, "切换按钮2");
      this.tblName = tab.label; //切换的时候把名字赋值上去，判断是否为码设置.
      if (this.tebleParam.name != tab.name) {
        this.queryParams = {
          pageSize: 10,
          pageNum: 1,
        };
        this.total = 0;
      }
      this.tebleParam.name = tab.name;
      this.tebleParam.label = tab.label;

      // 获取归属人和用户昵称的下拉框
   


          const Owner = await selectUserGroupRelaList();
      console.log(Owner, "归属人列表");
      if (Owner.code == 200) {
        this.optionss = Owner.data.groupRelaList;
      };
         this.optionss.splice(0, 0, { nickName: "自己", userId:this.userId-0 });


      this.common(this.$route.query.proId - 0, tab.name);

      this.CodeSetting(tab.label, tab.name);
    },
    //判断脱敏码设置等切换按钮是否显示
    async divShow() {
      const getdata = await selectByProId({
        userId: this.userId,
        proId: this.$route.query.proId,
      });
      console.log(getdata, "获取参数");
      if (getdata.code == 200) {
        this.divShowData = getdata.data.proAuth;
        // getdata.data.proAuth.codeState; //码显示
        console.log(this.divShowData, "表头页面");
        // getdata.data.proAuth.dataHState; //数据汇总
        // getdata.data.proAuth.dataTeamState; //数据团队
        // getdata.data.proAuth.dataTState; //数据脱敏
      }
    },
    //查看上级
    async otherExport(row) {
      console.log(row, "查看上级数据");
      this.SuperiorShow = true;
      const { data } = await selectByHierarchy({ userId: row.user_id - 0 });
      this.CheckSuperiorData = data;
      this.CheckSuperiorNumber = data.length - 1;
      console.log(this.CheckSuperiorNumber, "数字");
      console.log(data, "返回数据");
    },
    //查看上级关闭按钮
    onClose() {
      this.$refs["elForm"].resetFields();
    },
    // 码设置-下载模板按钮
    async upltemplate() {
      let param = (param = {
        proId: this.$route.query.proId - 0,
        configTypeId: this.tebleParam.name - 0, //脱敏是2  汇总是9
      });
      // if (this.$route.query.judgeParam - 0 == 1) {
      //   param = {
      //     proId: this.$route.query.proId - 0,
      //     configTypeId:2, //脱敏是2  汇总是9
      //   };
      // } else {
      //   param = {
      //     proId: this.$route.query.proId - 0,
      //     configTypeId: 9, //脱敏是2  汇总是9
      //   };
      // }
      console.log(param, "下载模板给后端传递的值");
      const res = await downLoadFormwork(param);

      var downloadUrl = window.URL.createObjectURL(res); //转换
      //添加一个a标签，利用a标签打开表格
      var anchor = document.createElement("a");
      anchor.href = downloadUrl;
      anchor.download = decodeURI("模板.xlsx");
      anchor.click();
    },

    // 码设置-批量划拨/回收下载模板按钮
    async downloadTemplate() {
      const res = await transferFormwork();
      var downloadUrl = window.URL.createObjectURL(res); //转换
      //添加一个a标签，利用a标签打开表格
      var anchor = document.createElement("a");
      anchor.href = downloadUrl;
      anchor.download = decodeURI("模板.xlsx");
      anchor.click();
    },

    handleMouseEnter() {},
    //单条划拨
    singletransfer() {
      this.$refs["transferData"].validate(async (valid) => {
        if (valid) {
          let param = {
            configTypeId: this.tebleParam.name - 0,
            idList: [this.temporary], //码ID集合
            proId: this.$route.query.proId - 0,
            receiveUserId: this.transferData.field102, //接收人ID
            state: this.transferData.field101, //向下1，向上4
            transferUserId: this.userId, //userID
          };
          console.log(param, "单条划拨");
          const data = await userTransfer(param);
          if (data.code == 200) {
            this.transferDialogVisible = false;
            this.$message({
              type: "success",
              message: "划拨成功!",
            });
            this.switchButton(); //更新页面
          }
          console.log(data, "单条划拨回调");
          // const data = await userTransfer(param);
        }
      });
    },
    //批量回收按钮
    async recoveryClick() {
      let param = {
        proId: this.$route.query.proId - 0,
        userId: this.userId,
        idList: this.variable,
      };
      const data = await tenantByRecovery(param);
      console.log(data, "批量回收后端得数据");
      if (data.code == 200) {
        this.recoveryVisible = false;
        this.switchButton(); //更新页面
        this.$message({
          type: "success",
          message: "操作成功!",
        });
      }
      this.variable = [];
      console.log("批量回收");
    },
    //批量向上向下划拨
    async transferschange() {
      console.log(this.transferData.field101, "划拨");
      // 1向下划拨  4向上
      switch (this.transferData.field101) {
        case 1:
          const lower = await selectUserGroupRelaList();
          console.log(lower, "向下划拨");
          if (lower.code == 200) {
            lower.data.groupRelaList.push({
              nickName: "自己",
              userId: this.userId,
            });
            this.transferOptions = lower.data.groupRelaList;
          }
          break;
        case 4:
          const upper = await selectBySuperior({ userId: this.userId });
          console.log(upper, "向上划拨");
          if (upper.code == 200) {
            this.transferOptions[0].nickName = upper.data.phoneNumber;
            this.transferOptions[0].value = upper.data.userId;
          }
          break;
      }
    },

    //脱敏数据重置按钮
    desensitizationReset(form, index) {
      //团队汇总搜索
      this.teamformData = {
        field103: "",
        field102: [],
      };
      //会员汇总搜索
      this.memberformData = {
        field103: "",
        field102: [],
      };
      //码汇总数据搜索
      this.summaryformData = {
        field102: [],
        field103: "",
        field104: "",
        field105: "",
        field106: "",
      };
      this.SettingParam = {
        valueTime: [],
        cTime: "",
        eTime: "",
        id: "", //系统ID
        maBiaoShi: "", //广告位名称
        maLianJie: "", //广告位链接
        maName: "",
        proId: undefined,
        pageNum: 1,
        pageSize: 10,
        state: undefined, //已使用1,0未分配
        wbList: [], //文本集合
        userId: "", //归属人
      };

  //           this.SettingParam.valueTime[0]=this.moment().format('YYYY')+'-'+this.moment().format('MM')+'-'+"01"+""+"00:00:00";
  // this.SettingParam.valueTime[1]=this.moment().format('YYYY-MM-DD')+""+"23:59:59";



      this.switchButton(1); //更新页面
      this.$refs[form].resetFields();
      // console.log(index,'重置222');
    },

    //单条回收按钮
    editBotton(row) {
      console.log(row, "回收");
      this.$confirm("此操作将回收该数据, 是否继续?", "", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(async () => {
          const array = [];
          array.push(row.id);

          let param = {
            proId: this.$route.query.proId - 0,
            userId: this.userId,
            idList: array,
          };
          console.log(param, "回收后端得数据");
          const data = await tenantByRecovery(param);
          console.log(data, "回收后端得数据");
          if (data.code == 200) {
            this.switchButton(); //更新页面
            this.$message({
              type: "success",
              message: "操作成功!",
            });
          }
        })
        .catch(() => {});
    },
    actionUrl() {
      return "";
    },
    //上传码按钮
    handleChange(file, fileList) {
      if (fileList.length > 1) {
        fileList.splice(0, 1);
      }

      let formData = new FormData();
      // formData.append("avatarfile", file.raw);
      formData.append("file", file.raw);
      formData.append("proId", this.$route.query.proId - 0);
      //脱敏是2  汇总是9
      formData.append("configTypeId", this.tebleParam.name - 0);
      // if(this.$route.query.judgeParam - 0 == 1){
      //    formData.append("configTypeId", 2);
      // }else{
      //    formData.append("configTypeId", 9);
      // }
      // 调用后端接口,file就是给后端的字段，可以更改
      uploadCode(formData).then((data) => {
        console.log(data, "222");
        if (data.code == 200) {
          this.$message({
            message: "上传成功!",
            type: "success",
          });
          this.uploadDialogVisible = false;
          this.switchButton(); //更新页面
        }
      });
    },
    // 脱敏数据上传数据功能
    handleChange8(file, fileList) {
      if (fileList.length > 1) {
        fileList.splice(0, 1);
      }
      this.mauplist = new FormData();
      // formData.append("avatarfile", file.raw);
      this.mauplist.append("file", file.raw);
      this.mauplist.append("proId", this.$route.query.proId - 0);

      // if(this.$route.query.judgeParam-0==1){
      //    this.mauplist.append("configTypeId", 3);
      // }else{
      //    this.mauplist.append("configTypeId", 11);
      // }
    },
    //批量划拨上传按钮
    handleChange2(file, fileList) {
      if (fileList.length > 1) {
        fileList.splice(0, 1);
      }
      let formData = new FormData();
      // formData.append("avatarfile", file.raw);
      formData.append("file", file.raw);
      // 调用后端接口,file就是给后端的字段，可以更改
      uploadtransfer(formData).then((data) => {
        console.log(data, "222");
        if (data.code == 200) {
          this.$message({
            message: "上传成功!",
            type: "success",
          });
          this.variable = data.data;
        }
      });
    },
    //批量回收上传按钮
    handleChange3(file, fileList) {
      let formData = new FormData();
      // formData.append("avatarfile", file.raw);
      formData.append("file", file.raw);
      // 调用后端接口,file就是给后端的字段，可以更改
      // AlipayUpload(formData).then((data) => {
      //   console.log(data, "222");
      // });
    },
    //上传码
    field101BeforeUpload() {
      let isRightSize = file.size / 1024 / 1024 < 2;
      if (!isRightSize) {
        this.$message.error("文件大小超过 2MB");
      }
      return isRightSize;
    },
    field103fileList() {},
    field103Action() {},
    field103BeforeUpload() {},
    //全选取消全选
    checkShow() {
      if (this.checkBox == 0) {
        this.roleList.map((row) => {
          row.remark = true;
        });
        this.checkBox = 1;
      } else {
        this.roleList.map((row) => {
          row.remark = false;
        });
        this.checkBox = 0;
      }
    },
    //划拨按钮
    async transferBotton(row) {
      console.log(this.transferData.field101, "单条划拨");
      console.log(row, "单条划拨222");
      this.temporary = row.id;
      switch (this.transferData.field101) {
        case 1:
          const lower = await selectUserGroupRelaList();
          console.log(lower, "向下划拨");
          if (lower.code == 200) {
            lower.data.groupRelaList.push({
              nickName: "自己",
              userId: this.userId,
            });
            this.transferOptions = lower.data.groupRelaList;
          }
          break;
        case 4:
          const upper = await selectBySuperior({ userId: this.userId });
          console.log(upper, "向上划拨");
          //  if(data.code==200){
          //    this.transferOptions=data.data.list;
          //  };
          break;
      }
      this.transferDialogVisible = true;
      this.transferData.field102 = "";
    },
    //批量划拨弹窗确定键
    transferClick() {
      this.$refs["transferData"].validate(async (valid) => {
        if (valid) {
          if (this.variable.length > 0) {
            let param = {
              idList: this.variable, //码ID集合
              proId: this.$route.query.proId - 0,
              receiveUserId: this.transferData.field102, //接收人ID
              state: this.transferData.field101, //向下1，向上4
              transferUserId: this.userId, //userID
              configTypeId: this.tebleParam.name - 0,
            };
            const data = await userTransfer(param);
            if (data.code == 200) {
              this.drawingVisible = false;
              this.$message({
                type: "success",
                message: "划拨成功!",
              });
              this.switchButton(); //更新页面
            } else {
              this.variable = [];
            }
            console.log(data, "批量划拨回调");
          } else {
            this.$message({
              message: "请上传模板文件!",
              type: "warning",
            });
          }
        }
      });
    },
    //码设置新增弹窗确定键
    addClick() {
      this.$refs["addrData"].validate(async (valid) => {
        if (valid) {
          let param = {
            proId: this.$route.query.proId - 0,
            userId: this.userId,
            codeName: this.addrData.field101,
            configTypeId: this.tebleParam.name - 0,
          };
          const data = await userNewCode(param);
          if (data.code == 200) {
            this.$message({
              message: "新增成功!",
              type: "success",
            });
            this.addDialogVisible = false;
            this.addrData.field101 = "";
            this.switchButton(); //更新页面
          } else {
            this.$message.error("操作失败!");
          }
          console.log(data, "回调");
        }
        // this.close();
      });
    },
    //快速新增弹窗确定键
    fastaddClick() {
      this.$refs["fastaddrData"].validate(async (valid) => {
        if (valid) {
          let param = {
            proId: this.$route.query.proId - 0,
            userId: this.userId,
            num: this.fastaddrData.field101,
            configTypeId: this.tebleParam.name - 0,
          };
          const data = await userNewCode(param);
          if (data.code == 200) {
            this.$message({
              message: "新增成功!",
              type: "success",
            });
            this.fastaddDialogVisible = false;
            this.fastaddrData.field101 = "";
            this.switchButton(); //更新页面
          } else {
            this.$message.error("操作失败!");
          }
          console.log(data, "回调");
        }
      });
    },
    //删除
    delBotton(row) {
      this.$confirm("此操作将删除, 是否继续?", "", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(async () => {
          let param = {
            idList: [row.id],
            proId: this.$route.query.proId - 0,
          };
          const data = await deleteByIds(param);
          console.log(data, "删除");
          if (data.code == 200) {
            this.switchButton(); //更新页面
            this.$message({
              type: "success",
              message: "操作成功!",
            });
          }
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消",
          });
        });
    },
    //批量划拨
    async transfersBotton() {
      console.log(this.transferData.field101, "向上划拨");
      // 1向下划拨  4向上
      switch (this.transferData.field101) {
        case 1:
          const lower = await selectUserGroupRelaList();
          console.log(lower, "向下划拨");
          if (lower.code == 200) {
            lower.data.groupRelaList.push({
              nickName: "自己",
              userId: this.userId,
            });
            this.transferOptions = lower.data.groupRelaList;
          }
          break;
        case 4:
          const upper = await selectBySuperior({ userId: this.userId });
          console.log(upper, "向上划拨");
          //  if(data.code==200){
          //    this.transferOptions=data.data.list;
          //  };
          break;
      }
      this.transferData.field102 = "";
      this.drawingVisible = true;
    },
    //查询
    selectByZD() {
      let data = {
        proId: this.proId,
        type: 0,
      };
      selectByZD(data).then((data) => {
        console.log(data.data);
        this.dataHeader = data;
        // for(var a=0;a<data.length;a++){
        //            this.tHeaders.push(data[a].bieName)
        //            this.filterVals.push(data[a].idName)
        //          }
      });
    },

    UploadUrl() {
      return "";
    },
    //
    // 脱敏数据上传确定按钮
    SummaryButton() {
      if (this.Summary.field104 == undefined) {
        this.$message({
          message: "时间不能为空！",
          type: "error",
        });
        return;
      }
      let formData = this.mauplist;
      formData.append("date", this.Summary.field104);
      if (this.$route.query.judgeParam - 0 == 2) {
        hzuploadlDate(formData).then((data) => {
          console.log(data, "111");
          if (data.code == 200) {
            this.$message({
              message: "上传成功!",
              type: "success",
            });
            this.switchButton(); //更新页面
            this.Summary.field104 = undefined;
            this.uploadButtonSummary = false;
          }
        });
      } else {
        uploadlaxisDate(formData).then((data) => {
          console.log(data, "111");
          if (data.code == 200) {
            this.$message({
              message: "上传成功!",
              type: "success",
            });
            this.switchButton(); //更新页面
            this.Summary.field104 = undefined;
            this.uploadButtonSummary = false;
          }
        });
      }
    },
    submitForm() {
      this.$refs["elForm"].validate((valid) => {
        if (!valid) return;
        // TODO 提交表单
      });
    },
    resetForm() {
      this.$refs["elForm"].resetFields();
    },

    resetForm(formName) {
      this.$refs[formName].resetFields();
    },

 
    /** 搜索按钮操作 */
    async handleQuery() {
      console.log(this.queryParams.dateRange, "时间");
      let param = {
        beginDate: this.queryParams.dateRange[0], //创建时间
        endDate: this.queryParams.dateRange[1],
        proId: this.queryParams.amountType,
        amountType: this.activeName,
      };
      const data = await selectCapPoolAccountRecordList(param);
      console.log(data, "搜索结果");
      this.roleList = data;
      this.total = data.length;

      const card = await capPoolAccountRecordStatistics(param);
      this.CardData = card;
      console.log(card, "获取卡片");

      if (this.activeName == "0") {
        console.log(this.queryParams, "佣金搜索按钮");
      } else if (this.activeName == "1") {
        console.log(this.queryParams, "分润搜索按钮");
      } else {
        console.log(this.queryParams, "其它搜索按钮");
      }

      // this.queryParams.pageNum = 1
    },
  },
  computed: {
    transferState() {
      if (this.variable.length > 0) {
        return true;
      } else {
        return false;
      }
    },
    //数据明细和汇总数据编辑如果有空就不能点确定
    shujuButton() {
      return this.editJudge.find((item) => {
        if (item.text == "") {
          return true;
        } else {
          return false;
        }
      });
    },
  },
};
</script>
<style scoped lang="scss">
//弹窗在屏幕中间
::v-deep .el-dialog__wrapper {
   display: flex;
   justify-content: center;
   align-items: center;
}
::v-deep .el-dialog:not(.is-fullscreen) {
  margin-top: 0vh !important;
}
.xhxBox2 {
  border-top: 1px #eee solid;
  height: 5px;
  margin: 5px 0px;
}
//统计的便签
//统计的便签
.LabelBox {
  // border: 1px red solid;
  margin: 10px 0px;
  display: flex;
  
  align-items: flex-end;
  justify-content: space-between;
  .LabelMiniBox {
    bottom: 0px;
    width: 90%;
   height: 60px;
    // border: 1px red solid;
    display: flex;
    align-items: center;
    // margin-right: 10px;
    .LabelMiniBox_span{
      height: 100%;
      display: flex;
      padding-left: 5px;
       align-items: center;
      background: rgb(238, 238, 238);
      // margin-left: 5px;
    }
  }
}
::v-deep .el-tabs__nav-wrap::after {
  background: #ffffff;
}
.textBox {
  color: rgb(175, 175, 175);
}
.textBox2 {
  color: #538aff;
}
</style>
<style lang='scss'>
.xhxBox {
  border-top: 1px #eee solid;
  height: 5px;
}
.el-card__header {
  border-bottom: none;
}
.xhxShow {
  border-bottom: 2px solid #538aff;
}
.topDiv {
  overflow: hidden;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
  padding: 20px;
  height: auto;
  .title {
    height: 50px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    img {
      height: 30px;
      margin-right: 10px;
    }
  }
  .containers {
    height: 130px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    padding: 20px;
  }
}
</style>
